package com.gxa.day2022_07_29_21.homework.others.log;

import com.gxa.day2022_07_29_21.homework.others.User;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:用户登录类
 * @Author: zhuiyi
 * @CreatTime: 2022/7/30 22:04
 **/
public class Login {
    static List<User> userList = new ArrayList<>();
    public User login(String username,String password){
        User user = new User(username, password);
        for(User user1 : userList){
            if (user.equals(user1)) {
                return user1;
            }
        }
        return null;
    }

    static {
        User user = new User(1001, "admin", 23, "123456");
        User user1 = new User(1008, "zs", 23, "123456");
        User user2 = new User(1009, "l4", 24, "123456");
        userList.add(user);
        userList.add(user1);
        userList.add(user2);

    }
}
